package com.leilei.serviceProject.domain.strategy.service.rule.chain.impl;

import com.leilei.serviceProject.domain.strategy.model.entity.RaffleFactorEntity;
import com.leilei.serviceProject.domain.strategy.service.armory.IStrategyDispatch;
import com.leilei.serviceProject.domain.strategy.service.rule.chain.AbstractLogicChain;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * @author yanglei
 * @description
 * @create 2024/11/12 23:38
 */
@Slf4j
@Component("default")
public class DefaultLogicChain extends AbstractLogicChain {
    @Resource
    private IStrategyDispatch strategyDispatch;

    @Override
    public Integer logic(RaffleFactorEntity raffleFactorEntity) {
        Integer awardId = strategyDispatch.getRandomAwardId(raffleFactorEntity.getStrategyId());
        log.info("抽奖责任链-默认处理 strategyId:{},userId:{},ruleModel:{},award:{}", raffleFactorEntity.getStrategyId(),
                raffleFactorEntity.getUserId(), raffleFactorEntity.getRuleModel(), awardId);
        return awardId;
    }

    @Override
    protected String ruleModel() {
        return "default";
    }
}
